package com.util;

public class PageUtil<T> {

    /**
     * 每页显示的记录条数
     */
    private  int pageSize;
    /**
     * 总页数
     */
    private  int totalPage;
    /**
     * 总记录数
     */
    private  int totalRecord;
    /**
     * 当前的页码
     */
    private  int currentPage;

    /**
     * 查询结果保存在此属性中
     */
    private  T data;

    public PageUtil(int pageSize, int totalRecord, int currentPage, T data) {
        this.pageSize = pageSize;
        this.totalRecord = totalRecord;
        this.currentPage = currentPage;
        this.data = data;
        if (totalRecord%pageSize==0){
            this.totalPage=totalRecord/pageSize;
        }else{
            this.totalPage=totalRecord/pageSize+1;
        }
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    public int getTotalRecord() {
        return totalRecord;
    }

    public void setTotalRecord(int totalRecord) {
        this.totalRecord = totalRecord;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
